<template>
  <div id="aboutChild">
    <h1>about-child 组件-- {{this.$store.state.name}} </h1>
    <h1>about-child 组件-- {{this.$store.getters.getNameGetter}} </h1>
    <button @click="changNameAction">改变 vue 当中的 name 数据</button>
  </div>
</template>
<script>
import { mapActions } from 'vuex'
// import bus from '../bus'
export default {
  name: 'AboutChild',
  data () {
    return {
      // name: 'aboutChild-name'
    }
  },
  beforeCreate () {
    console.log('aboutChild', 'beforeCreate()')
    // bus.$on('getHomeName', homeName => {
    //   // console.log('获取的事件被触发', homeName)
    //   this.name = homeName
    // })
  },
  created () {
    console.log('aboutChild', 'created()')
  },
  mounted () {
    console.log('aboutChild', 'mounted()')
  },
  methods: {
    // changeName () {
    //   this.$store.dispatch('changNameAction', '在 AboutChild 里面改变的name')
    // }
    ...mapActions([
      'changNameAction'
    ])
  }
}
</script>
